//
//  WJShopFooterView.m
//  JerryIos
//
//  Created by 王军 on 2018/2/6.
//  Copyright © 2018年 王军. All rights reserved.
//

#import "WJShopFooterView.h"

@interface WJShopFooterView()

@property (weak, nonatomic) IBOutlet UIButton *loadBtn;
@property (weak, nonatomic) IBOutlet UIView *loadingView;

@end

@implementation WJShopFooterView

+(instancetype) footerView {
    NSArray *viewArray = [[NSBundle mainBundle] loadNibNamed:@"WJShopFooterView" owner:nil options:nil];
    return [viewArray lastObject];
}

//点击加载按钮
-(IBAction) loadBtnClick {
    //隐藏加载按钮
    self.loadBtn.hidden = YES;
    //显示“正在加载”
    self.loadingView.hidden = NO;
    //暂停两秒
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        //通知代理
        if ([self.delegate respondsToSelector:@selector(shopFooterViewDidClick:)]) {
            [self.delegate shopFooterViewDidClick:self];
        }
        //显示加载按钮
        self.loadBtn.hidden = NO;
        //隐藏“正在加载”
        self.loadingView.hidden = YES;
    });
}

@end
